/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */
#pragma once

#include <xml/Object.h>
#include <filesystem/String.hpp>
#include "AbstractFont.h"
#include <memory>

namespace TrueText { class Font; }

namespace liba { 

namespace resource { class Resource; }

namespace font {

struct FontInfo;

class TrueType
	: public xml::ObjectUnicode
	, public AbstractFont
{
public:
	TrueType(resource::Resource* resource, const filesystem::String & name);
	TrueType(const TrueType & other);
	~TrueType();

	virtual void Accept(FontVisitor* visitor);

	TrueText::Font* Font();
	
	virtual TrueType * clone()
	{
		return new TrueType(*this);
	}
protected:
	virtual bool on_attribute( xml::Provider * prov, const std::wstring & name, const std::wstring & value );
	virtual bool on_end_node( xml::Provider * prov );
private:
	bool createFont();
private:
	std::auto_ptr<FontInfo> info;
	std::auto_ptr<TrueText::Font> font;
};

} // namespace font
} // namespace liba